#pragma once

#include <QtOpenGL>
#include <QVector>
#include <QVarLengthArray>
#include "Primitive.h"

using namespace CAD_CAM;

namespace Curves
{
	class CZeroCurve
	{
	public:
		CZeroCurve(void);
		~CZeroCurve(void);

		void DrawShader(QGLShaderProgram& shaderProgram, QMatrix4x4& viewMatrix, QMatrix4x4& projectionMatrix);
		void addBezierVertex( const QVector3D & v);
		void removeBezierVertex( int indx);

	private:
		void initBuffers(QGLBuffer::UsagePattern usage = QGLBuffer::StaticDraw);
		void replaceBezierPoint(const MyVertex & v, int i);
		void build();
		int curveVertices;
		int filledSegment;
		const int VerticesMax;
		QVector<MyVertex> bezierPoints;
		QVector<MyVertex> deBorePoints;

		QVector<int> bezierIndices;

		QGLBuffer mVertexVBO;
		QGLBuffer mIndexVBO;

		bool isInited;
	};
}